<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/stylesite.css" medial="all" />
<link rel="stylesheet" type="text/css" href="../css/styleleft.css" medial="all" />
<link rel="stylesheet" type="text/css" href="../css/style.css" medial="all" />
	<script src="../js/jquery-1.8.2.min.js" ></script>
	<script src="../js/image.js" type="text/javascript"></script>
        <script src="../js/jsearch.js" type="text/javascript"></script>  
	<link rel="stylesheet" href="../css/cloud-zoom.css"/>
	<script src="../js/cloud-zoom.1.0.2.min.js"></script>
	
	 <script type="text/javascript">
            function InputFocus(textdefault,control) {
    text = control.value;
    if (text == textdefault) control.value = "";
		}
		function InputBlur(textdefault,control) {
			text = control.value;
			if (text == "") control.value = textdefault;
		}
		 $(function (){
				$(".frmcomment").hide();
				$("#postcomment").click(function(){
				$(".frmcomment").slideToggle();
				});
				}); 
		 $(function (){
				$(".show-comment").hide();
				$("#showcomment").click(function(){
				$(".show-comment").slideToggle();
				});
				}); 
        </script>    
<title>Chi Tiết Sản Phẩm</title>
</head>

<body class="pagebody">
	<div id="wrapwebsite" >
				<?php
				
			include('../element/header.php');?>
			<div class="imagestop"></div>
			<div class="wrapmaincontent">
		<?php
		include('../element/leftside.php');
		?>
	
		<div class="center-leftmargin">
			<?php
			if(isset($_GET['i']))
			{
			 	$i=$_GET['i'];
			}
			 $name ='product'.$i;
			 if(isset($_SESSION[$name]))
		{
		  $pr=$_SESSION[$name];
		   include('product_model.php');
		  updateViewCount($pr[0]);
		  $view =getViewCount($pr[0]);
		 
		   ?>
		<div class="productdetail">
		<div class="title">
		<div class="title-content">
		<p class="p1"> <?php echo $pr[1];?>  </p>
		<!--<p class="p2"> Giá Bán: &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VND  </p>-->
		<?php if($pr[9]>0)
						{
						   $dis=$pr[9];
						   $tk=$pr[4]*$dis/100;
						   $pri=$pr[4]-$tk;
							echo "<p>Giá bán:<span style='color:#FF0000; font-size:20px;'>$pri  VND<br></span> Giá ban đầu:<span style='text-decoration:line-through; color:#999999; '> $pr[4] VND</span><br><span style='color:#FF6600;'> Tiết kiềm:$tk VND</span><br></p>";
						} else {?>
						<p> Giá Bán: <?php echo $pr[4];?>&nbsp;&nbsp;VND<br><?php }?></p>
		<p class="p3"> Số lượt xem:&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $view;?>  </p>
		<p class=""><a href="../ShoppingCart/Cart_Controller.php?prid=<?php echo $pr[0]; ?>&act=add"><img src="../images/addcart.png"/></a></p></div>
		<a href='<?php echo $pr[3];?>' class ='cloud-zoom' rel="tint: '#ff0000',tintOpacity:0.5 ,smoothMove:5,zoomWidth:480, adjustY:-4, adjustX:10" >
		<div class="image"><img src="<?php echo $pr[3];?>"/></div></a>
		</div>
		<div class="detail">
		<p>Chi Tiết :  </p>
		<div class="content"><?php echo $pr[2];?></div>
		</div>
		<!-- AddThis Button BEGIN -->
		<div class="social" style="padding-left:461px;">
			<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
			<a class="addthis_button_preferred_1"></a>
			<a class="addthis_button_preferred_2"></a>
			<a class="addthis_button_preferred_3"></a>
			<a class="addthis_button_preferred_4"></a>
			<a class="addthis_button_compact"></a>
			<a class="addthis_counter addthis_bubble_style"></a>
			</div>
			<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
			<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-50b4ccf61dcab94f"></script>
			<!-- AddThis Button END -->
			</div>
		<div class="comment">
		<p> <img src="../css/images/bg_cmm.png" id="postcomment" >Gửi bình luận</img><img src="../css/images/bg_cmm.png"id="showcomment">Xem phản hồi</img></p>
		<div class="frmcomment">
		<form action="Product_Controler.php" method="post">
		<input type="hidden" value="<?php echo $pr[0];?>" name="proid"/>
		<input type="hidden" value="<?php echo $i;?>" name="i"/>
		<div class="hoten">
		<input type="text" name="txtName" value="Họ Tên" onFocus="InputFocus('Họ Tên', this);" onBlur="InputBlur('Họ Tên', this);"/>
		
		<input type="text" value="Email" name="txtEmail" onBlur="InputBlur('Email', this);" onFocus="InputFocus('Email', this);"/></div>
		
		<textarea name="content"  style="width:366px; height:130px"  title="Nội dung" onFocus="InputFocus('Nội dung', this);" onBlur="InputBlur('Nội dung', this);">Nội dung</textarea>
		<div class="submit">
		<input type="submit" value="Gửi" name="post-comment"/></div>
		</form>
		</div>
		
		<div class="show-comment">
		
		<?php 
		$commentshow=getCommentShow($pr[0]);
		$delete='delete';
		$show='show';
		$unshow='unshow';
		foreach ($commentshow as $cm)
		{
			
		  echo "<div class='show'><div class='comment-item'> <p>".$cm[2].":";
		  if (isset($_SESSION['user'])&& $_SESSION['user'][4]!='user')
			{
			echo "<a href='Product_Controler.php?cmid=$cm[0]&prid=$i&acc=$delete'><img src='../images/1318498996_DeleteRed.ico' width='25px'; height='25px'></a><a href='Product_Controler.php?cmid=$cm[0]&prid=$i&acc=$unshow'><img src='../images/unshow.png' width='25px'; height='25px'/></a>";
		 	}
		 echo " </p><div class='cm-content'>".$cm[1]."</div></div></div>" ;
		}
		if (isset($_SESSION['user'])&& $_SESSION['user'][4]!='user')
		{
		 	$cmhidden=getCommentHidden($pr[0]);
			foreach ($cmhidden as $cm)
		{
		  echo "<div class='show'><div class ='comment-item'> <p>".$cm[2].": <a href='Product_Controler.php?cmid=$cm[0]&prid=$i&acc=$delete'><img src='../images/1318498996_DeleteRed.ico' width='25px'; height='25px'/></a><a href='Product_Controler.php?cmid=$cm[0]&prid=$i&acc=$show'><img src='../images/show.png' width='25px'; height='25px'/></a></p><div class='cm-content'>".$cm[1]."</div></div></div>" ;
		  
		  
		}
		}
		?>
		<div class="hidden"></div>
		</div>
		</div>
		
		
		<?php }?>
		</div>
		
                   
		</div>
		</div> 
		
		<?php include('../element/footer.php'); ?>
</div>
</body>
</html>